Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of DateTime and Date formats #937

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

expobrain
Copy link

Adds full support for rendering Date and DateTime Marshmallow fields with each of their format values.

This solve the issue of Date and DateTime with a non-default format being rendered with format: null instead of format: date and format: date-time respectively.

@expobrain expobrain changed the title Supoort of DateTime and Date formats Support of DateTime and Date formats Sep 2, 2024
@expobrain expobrain marked this pull request as draft September 2, 2024 22:05
Copy link
Member

@lafrech lafrech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Thanks for digging into this.

I didn't take to time to review thoroughly but here's a question already.

Any idea why it stopped working as expected in version 6.4?

@@ -574,16 +573,62 @@ def datetime2properties(self, field, **kwargs: typing.Any) -> dict:
"example": "1676451277514.654",
"min": "0",
}
elif field.format is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, field.format can't be None due to line 549, right?

@bhperry
Copy link

bhperry commented Sep 26, 2024

Also, format and pattern should not ever by None, according to openapi spec they must be strings. Probably should be removed from the ret dict when they are None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants